<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        div{
            margin: 0 auto;
        }
        .box1{
            width: 1500px;
            height: 500px;
            background: lightblue;
        }
        .box2{
            width: 500px;
            height: 50px;
            background: green;
            position: sticky;
            top: 0;

        }
        .box3{
            width: 1500px;
            height: 1000px;
            background: red;
        }
    </style>
</head>
<body>
    <div class="box1"></div>
    <div class="box2"></div>
    <div class="box3"></div>
</body>
</html>